home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacWorld 1997 August
/
Macworld (1997-08).dmg
/
Shareware World
/
Info
/
For Developers
/
ictb Compiler 1.0
/
Example Project
/
Example.p
< prev
next >
Wrap
Text File
|
1997-06-17
|
2KB
|
73 lines
program Example;
uses
Types, Resources, Fonts, Windows, QuickDraw, Menus, TextEdit, Dialogs, Memory;
procedure SetDialogTextFont (window: DialogPtr; font, size: integer; face: Style);
var
saved_port: GrafPtr;
saved_font, saved_size: integer;
saved_face: Style;
fi: FontInfo;
te: TEHandle;
begin
GetPort( saved_port );
SetPort( window );
saved_font := window^.txFont;
saved_size := window^.txSize;
saved_face := window^.txFace;
TextFont( font );
TextSize( size );
TextFace( face );
GetFontInfo(fi);
te := DialogPeek(window)^.textH;
te^^.txFont := font;
te^^.txSize := size;
te^^.txFace := face;
te^^.lineHeight := fi.ascent + fi.descent + fi.leading;
te^^.fontAscent := fi.ascent;
TECalText(te);
TextFont( saved_font );
TextSize( saved_size );
TextFace( saved_face );
SetPort( saved_port );
end;
procedure Initialization;
var
i: integer;
begin
InitGraf(@qd.thePort);
InitFonts;
InitWindows;
InitMenus;
TEInit;
InitDialogs(nil);
MaxApplZone;
for i := 1 to 3 do begin
MoreMasters;
end;
end;
var
window, temp_window: WindowPtr;
item: integer;
begin
Initialization;
window := GetNewDialog( 128, nil, WindowPtr(-1) );
SetPort( window );
SetDialogTextFont( window, geneva, 9, [] );
SelectDialogItemText( window, 4, 0, 32767 );
ShowWindow( window );
repeat
ModalDialog( nil, item );
if item = 2 then begin
temp_window := GetNewWindow( 128, nil, WindowPtr(-1) );
DisposeWindow( temp_window );
end;
until item = 1;
DisposeDialog( window );
end.